<template>
  <div class="site-topbar">
    <div class="container">
      <div class="topbar-nav">
        <template v-for="(v, k) in nav" :key="k">
          <a rel="nofollow" href="#">{{ v }}</a>
          <span v-if="k < nav.length - 1" class="sep">|</span>
        </template>
      </div>
      <div class="topbar-cart">
        <a class="cart-mini">购物车（0）</a>
      </div>
      <div class="topbar-info">
        <template v-for="(v, k) in info" :key="k">
          <a rel="nofollow" href="#">{{ v }}</a>
          <span v-if="k < nav.length - 1" class="sep">|</span>
        </template>
      </div>
    </div>
  </div>
</template>
<script>
import { defineComponent, reactive, toRefs } from "vue";

export default defineComponent({
  name: "NavPart",
  setup() {
    const state = reactive({
      nav: [
        "小米商城",
        "MIUI",
        "IoT",
        "云服务",
        "天星数科",
        "有品",
        "小爱开放平台",
        "企业团购",
        "资质证照",
        "协议规则",
        "下载app",
        "Select Location",
      ],
      info: ["登录", "注册", "消息通知"],
    });

    return {
      ...toRefs(state),
    };
  },
});
</script>

<style lang="scss" scoped>
.site-topbar {
  position: relative;
  z-index: 30;
  height: 40px;
  font-size: 12px;
  color: #b0b0b0;
  background: #333;

  .container {
    width: 1226px;
    margin-right: auto;
    margin-left: auto;
  }
  .topbar-nav {
    float: left;
    height: 40px;
    line-height: 40px;
  }

  a {
    color: #b0b0b0;
    line-height: 40px;
    display: inline-block;
  }

  .sep {
    margin: 0 0.3em;
    color: #424242;
  }

  .topbar-info {
    position: relative;
    float: right;
    height: 40px;
    line-height: 40px;
  }
  .topbar-cart {
    position: relative;
    float: right;
    width: 120px;
    height: 40px;
    margin-left: 15px;
    -webkit-transition: all 0.2s;
    transition: all 0.2s;
    font-size: 12px;

    .cart-mini {
      position: relative;
      z-index: 32;
      display: block;
      height: 40px;
      line-height: 40px;
      text-align: center;
      color: #b0b0b0;
      background: #424242;
    }
  }
}

a,
a:hover {
  text-decoration: none;
}
</style>